#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //给comboBox添加元素
    ui->comboBox->addItem("请蒸排骨");
    ui->comboBox->addItem("番茄炒蛋");

    ui->comboBox_2->addItem("云吞面");
    ui->comboBox_2->addItem("蒸饺");

    ui->comboBox_3->addItem("雪碧");
    ui->comboBox_3->addItem("可乐");
    //给spinBox调整取值范围
    ui->spinBox->setValue(1);
    ui->spinBox->setRange(1,5);

    ui->spinBox_2->setValue(1);
    ui->spinBox_2->setRange(1,5);

    ui->spinBox_3->setValue(1);
    ui->spinBox_3->setRange(1,5);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    //打印选餐内容
    qDebug() << "选的主食: " << ui->comboBox->currentText() << "数量为: " << ui->spinBox->value()
             << "选择小吃: " << ui->comboBox_2->currentText() << "数量为: " << ui->spinBox_2->value()
             << "选择的饮料: " << ui->comboBox_3->currentText() << "数量为: " << ui->spinBox_3->value();
}
